package com.youngjun.generator;

import java.util.ArrayList;
import java.util.List;

/**
 * @author VirgunJun
 */
public final class GeneratorConfig {

    /**
     * 数据库驱动类型
     */
    public static final String DRIVER = "com.mysql.cj.jdbc.Driver";

    /**
     * 数据库连接地址
     */
    public static final String URL = "jdbc:mysql://localhost:3308/user?useInformationSchema=true";

    /**
     * 数据库连接用户名
     */
    public static final String USER = "root";

    /**
     * 数据库连接密码
     */
    public static final String PASSWORD = "root";

    /**
     * 生成的JAVA代码路径
     */
    public static final String JAVA_OUT_PATH = "D:\\Project\\demo-maven\\generator\\target\\out\\java";

    /**
     * 生成的XML代码路径
     */
    public static final String XML_OUT_PATH = "D:\\Project\\demo-maven\\generator\\target\\out\\xml";

    /**
     * 代码模板路径
     */
    public static final String TEMPLATE_PATH = "/templates";

    /**
     * 是否生成DOMAIN
     */
    public static final boolean IS_GENERATOR_DOMAIN = true;

    /**
     * 是否生成DTO
     */
    public static final boolean IS_GENERATOR_DTO = true;

    /**
     * 是否生成VO
     */
    public static final boolean IS_GENERATOR_VO = false;

    /**
     * 是否生成MAPPER
     */
    public static final boolean IS_GENERATOR_MAPPER = true;

    /**
     * 是否生成MAPPER_XML
     */
    public static final boolean IS_GENERATOR_MAPPER_XML = true;

    /**
     * 是否生成SERVICE
     */
    public static final boolean IS_GENERATOR_SERVICE = true;

    /**
     * 是否生成SERVICE_IMPL
     */
    public static final boolean IS_GENERATOR_SERVICE_IMPL = true;

    /**
     * 是否生成CONTROLLER
     */
    public static final boolean IS_GENERATOR_CONTROLLER = true;

    /**
     * 不需要导入的类
     */
    public static final String[] NOT_NEED_IMPORT_CLASS_NAMES = {};

    /**
     * 表集合
     */
    public static final List<Table> TABLES = new ArrayList<Table>() {
        {
            //包名配置
            Config config = new Config()
                    .setDomainPackage("com.youngjun.user.pojo.domain")
                    .setDomainNameSuffix("")
                    .setDomainTpl("Domain.ftl")
                    .setDtoPackage("com.youngjun.user.pojo.dto")
                    .setDtoNameSuffix("DTO")
                    .setDtoTpl("Dto.ftl")
                    .setMapperPackage("com.youngjun.user.mapper")
                    .setMapperNameSuffix("Mapper")
                    .setMapperTpl("Mapper.ftl")
                    .setServicePackage("com.youngjun.user.service")
                    .setServiceNameSuffix("Service")
                    .setServiceNameTpl("Service.ftl")
                    .setServiceImplPackage("com.youngjun.user.service.impl")
                    .setServiceImplNameSuffix("ServiceImpl")
                    .setServiceImplTpl("ServiceImpl.ftl")
                    .setControllerPackage("com.youngjun.user.controller")
                    .setControllerNameSuffix("Controller")
                    .setControllerNameTpl("Controller.ftl")
                    .setMapperXmlPath("mapper")
                    .setMapperXmlNameSuffix("Mapper")
                    .setMapperXmlTpl("MapperXML.ftl");
            //表映射
            add(new Table("t_user", "user", config));
            add(new Table("organization", config));
            add(new Table("role", config));
            add(new Table("function", config));
            add(new Table("interface", config));
            add(new Table("user_role", config));
            add(new Table("allow_access_function_role", config));
            add(new Table("allow_assign_function_role", config));
            add(new Table("function_interface", config));
            add(new Table("region", config));
            add(new Table("organization", config));
            add(new Table("department", config));
            add(new Table("document", config));
            add(new Table("address", config));

        }
    };

}
